/*用户接口路由*/
const Router = require('koa-router')

const {register,login,changePassword} = require('../controller/user.controller')
const { userValidator,verifyUser,crpytPassword,verifyLogin } = require('../middleware/user.middleware')
const { auth } = require('../middleware/auth.middleware')
const { validator } = require('../middleware/goods.middleware') 

const router = new Router({prefix:'/user'})

// 注册接口
router.post('/register', userValidator, verifyUser, crpytPassword, register)

// 登录接口
router.post('/login', verifyLogin, login)

// 修改密码接口
router.patch('/', auth, crpytPassword, validator, changePassword)

module.exports = router